package com.imooc.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置
 * @Author: 顾志杰
 * @Date: 2019/12/6
 * @Time: 11:00
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    /**
     * 实现静态资源映射
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**")
                //映射swagger2
                .addResourceLocations("classpath:/META-INF/resources/")
                //映射本地静态资源
                .addResourceLocations("file:D:\\work\\StudySpace\\face\\");

    }

//    @Bean
//    public UserTokenInterceptor userTokenInterceptor() {
//        return new UserTokenInterceptor();
//    }
//
//    /**
//     * 注册拦截器
//     *
//     * @param registry
//     */
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(userTokenInterceptor())
//                .addPathPatterns("/hello")
//                //添加拦截
//                .addPathPatterns("/userInfo/*")
//                .addPathPatterns("/center/*")
//                //移除拦截
//                .excludePathPatterns("/items/*");
//        WebMvcConfigurer.super.addInterceptors(registry);
//    }
}
